#ifndef SUPER_CONFIG_H
#define SUPER_CONFIG_H
#include "common.h"

#include <QMap>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>

class CSuperApi;

class CSuperConfig
{
public:
	CSuperConfig(void);
	~CSuperConfig(void);

public:
	bool ReadConfig();
	bool WriteConfig();

	void GetApiList(QList<CSuperApi*>& listApi);
	CSuperApi* GetApiByType(ApiType type);
	bool InsertApi(CSuperApi* pApi);
	bool RemoveApi(CSuperApi* pApi);

protected:
	void ReadApi(QXmlStreamReader& reader);
	void ReadType(QXmlStreamReader& reader,stSuperApi* pSuperApi);
	void ReadAccess(QXmlStreamReader& reader,stSuperApi* pSuperApi);
	void ReadAccessScret(QXmlStreamReader& reader,stSuperApi* pSuperApi);
	void ReadUserId(QXmlStreamReader& reader,stSuperApi* pSuperApi);
	void ReadIconFile(QXmlStreamReader& reader,stSuperApi* pSuperApi);
	void ReadHeaderFile(QXmlStreamReader& reader,stSuperApi* pSuperApi);

	void WriteApi(QXmlStreamWriter& writer,stSuperApi* pSuperApi);

public:
	QMap<ApiType,CSuperApi*> m_mapApi;
};


#endif	//SUPER_CONFIG_H
